salutations,
compiler: VC++ 6.0.
we are relatively new to C++ programming. we are trying to access a DLL, created in VB6, from C++.
to use the DLL, we used the #import command, and some other functions that were shown in a tutorial that we don't remember where we found.
initializing the DLL (COM) works; the problem arises when we try to call a function of it. the program's code is below. the VB DLL's project is named mbr and it contains a class named mbrl. when the function t->speak(...) is called, the following error happens:
"File: i386/chkesp.c
Line: 42
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."
here is the code (a small program):
thank you in advance.Code:#import "C:\WINDOWS\system32\mbr.dll" #include "iostream" #include <windows.h> using namespace std; using namespace mbr; int main(int argc, char* argv[]) { HRESULT hresult; CLSID clsid; _mbrl *t; _bstr_t bstrValue("k 100 100\n"); _bstr_t dbe("ar1"); _bstr_t oute("OUT.WAV"); _bstr_t bstrR(""); long freqe; long dure; long vole; long pite; long returne; freqe = 1; dure = 1; vole = 1; pite = 1; ::CoInitialize(NULL); hresult=CLSIDFromProgID(OLESTR("mbr.mbrl"), &clsid); hresult= CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER, __uuidof(_mbrl),(LPVOID*) &t); if(hresult == S_OK) { returne = t->speak(bstrValue, freqe, dure, vole, pite, dbe, oute); // <- ERROR HAPPENS HERE t->Release(); ::CoUninitialize; } return 0; }


